import MusicManager from "../../../../MusicManager";
import NuclearBombBase from "../../../facility/priveteFacility/NuclearBombBase";
import { Killer } from "../../../funcObj/interface/HealthPoint";
import { Location } from "../../../info/Predefine";
import FlyerMissile from "../FlyerMissile";

const { ccclass, property } = cc._decorator;
/**
 * 核弹
 */
@ccclass
export default class NuclearBomb extends FlyerMissile {

    @property([cc.SpriteFrame])
    rocketColor: cc.SpriteFrame[] = [];

    @property(cc.Sprite)
    show: cc.Sprite = null;

    init(base: NuclearBombBase, target: Location): void {
        super.init(base, target);
        this.show.spriteFrame = this.rocketColor[base.player.playerId];
    }

    protected preDispatch(): void {
        super.preDispatch();
        MusicManager.instance.play(MusicManager.instance.nuclearFire);
    }

    die(killer: Killer): void {
        MusicManager.instance.play(MusicManager.instance.nuclearBomb);
        super.die(killer);
    }

}
